<template>
	<view>
		<view class="tabs">
			<view class="tabs-one" @click="changetab(1)">
				<view class="tabs-top" :class="num==1?'color':''">
					奖励
				</view>
				<view class="tabs-color" :class="num==1?'avtive':''">

				</view>
			</view>
			<view class="tabs-one" @click="changetab(2)">
				<view class="tabs-top" :class="num==2?'color':''">
					惩罚
				</view>
				<view class="tabs-color" :class="num==2?'avtive':''">

				</view>
			</view>

		</view>

		<view class="cont">
			<view class="" v-if="num==1">
				<view class="box"  v-for="(item,index) in jclist" :key="index" @tap="goschedule(item)">
					<view class="box-one">
						<view class="box-title">
							{{item.jcsj}}
						</view>
						<view class="box-icon">
							<u-icon name="arrow-right"></u-icon>
						</view>
					</view>
					<view class="box-two">
						<view class="box-two-left">
							<view class="box-two-right">
								{{item.jcyy}}
							</view>
						</view>
					</view>

				</view>
			</view>
			
			<!-- 待我审批 -->
			<view class="" v-if="num==2">
				<view class="box" v-for="(item,index) in jclist" :key="index" @tap="goworkapproval(item)">
					<view class="box-one">
						<view class="box-title">
							{{item.jcsj}}
						</view>
						<view class="box-icon">
							<u-icon name="arrow-right"></u-icon>
						</view>
					</view>
					<view class="box-two">
						<view class="box-two-right">
							{{item.jcyy}}
						</view>
					</view>
			
				</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	import {pageList} from '@/api/userid.js'
	export default {
		data() {
			return {
				num: 1,
				userId:'',
				queryForm:{
					jcrid: '',
					pageNum: 1,
					jclb:1,
					pageSize: 10
				},
				jclist:[],
			};
		},
		onLoad() {
			
		},
		onShow() {
			this.userId=uni.getStorageSync('userId')
			console.log(this.userId,123)
			this.queryForm.jcrid=this.userId
			this.init()
		},
		methods: {
			init(){
				pageList(this.queryForm).then(res=>{
					this.jclist=res.data.list
				})
			},
			changetab(index) {
				this.num = index
				this.queryForm.jclb=index
				this.init()
			},
			goschedule(item){
				uni.navigateTo({
					url:`/pages/rewarddetails/rewarddetails?item=${encodeURIComponent(JSON.stringify(item))}`
				})
			},
			goworkapproval(item){
				
				uni.navigateTo({
					url:`/pages/punishmentfordetails/punishmentfordetails?item=${encodeURIComponent(JSON.stringify(item))}`
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #f5f5f5;
	}
	.avtive {
		background: #1989FA !important;
	}

	.color {
		color: #1989FA !important;
	}

	.tabs {
		display: flex;
		justify-content: space-around;
		background-color: #fff;
		.tabs-one {
			width: 311rpx;
			height: 82rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			.tabs-top {
				width: 112rpx;
				height: 44rpx;
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #999;
				line-height: 44rpx;
				text-align: center;
			}

			.tabs-color {
				width: 64rpx;
				height: 6rpx;
				margin-top: 15rpx;
				background: #fff;
			}
		}
	}

	.cont {
		padding: 40rpx 24rpx;
		background-color: #f6f6f6;

		.box {
			padding: 32rpx 48rpx;
			background-color: #fff;
			border-radius: 16px 16px 16px 16px;
			margin-bottom: 20rpx;

			.box-one {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding-bottom: 20rpx;
				margin-bottom: 20rpx;
				border-bottom: 1px solid #EEEEEE;

				.box-title {
					font-size: 32rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #333333;
				}

				.box-icon {}
			}

			.box-two {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 20rpx;
				border-radius: 8px 8px 8px 8px;
				background: #F6F6F6;

				.box-two-left {
					display: flex;
					align-items: center;

					img {
						width: 28rpx;
						height: 28rpx;
					}

					font-size: 24rpx;
					font-family: PingFang SC-Medium,
					PingFang SC;
					font-weight: 500;
					color: #999999;
				}

				.box-two-right {
					
					font-size: 24rpx;
					font-family: PingFang SC-Medium,
					PingFang SC;
					font-weight: 500;
					color: #999999;
				}
			}
		}
	}
</style>
